-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numeric attribute fix #180
Conversation
The problem is that it's also special-casing numeric attributes, so I can no longer use |
You can, unnamed attributes in WP are placed as numeric keys in the Tested this using Jetpack's googlemaps shortcode:
The |
Also related - #128 I'm not sure how we would tackle this. EDIT - Oh - I see you already commented on this. |
Did some tests and it seems that this PR just solves part of the problem. Will get back with an explanation. |
I think we should have some unit test coverage here. |
Now unnamed attributes are rendered, but editing them removes the values
After extensive testing and debugging, I'm revamping my fix for this. I think this is the right way to approach this. The real problem: unnamed attributes are not recognized by the editor views & the UI I removed my initial commit with the regex, and now the views recognize the unnamed attributes. The fix is to handle unnamed attributes as numeric ones. That means:
Will now generate:
WordPress/PHP-wise, these attributes are accessible using the normal The fix is not yet complete. The only thing missing now is that editing an existing shortcode turns the attribute input fields blank, like the values are not being found. |
The last part of the solution may be is to add another regex at the function |
Alright, finally finished the fix. I'm very well pleased with the results. |
Since the code has changed a lot since wp-shortcake#180, I’m redoing the changes with the new file structure
Closing and doing a new cleaner PR #198, since this now has tons of conflicts. |
We just landed some big changes to the structure of the JS. Apologies for the conflicts! |
No problem! It's about time I tried to learn how to use grunt. |
Fixes #128
Doing this
creates a shortcode with an attribute
0="value"
, WordPress cannot parse this as an unnamed attribute. The regex here removes numeric attributes and removes them. This doesn't affect attribute-like strings outside the shortcode definition and doesn't affect normal string attributes.